package com.ruoyi.myshop.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.myshop.mapper.HomeMapper;
import com.ruoyi.myshop.domain.Home;
import com.ruoyi.myshop.service.IHomeService;

/**
 * 首页配置Service业务层处理
 * 
 * @author HuaQP
 * @date 2024-09-14
 */
@Service
public class HomeServiceImpl implements IHomeService 
{
    @Autowired
    private HomeMapper homeMapper;

    /**
     * 查询首页配置
     * 
     * @param id 首页配置主键
     * @return 首页配置
     */
    @Override
    public Home selectHomeById(Long id)
    {
        return homeMapper.selectHomeById(id);
    }

    /**
     * 查询首页配置列表
     * 
     * @param home 首页配置
     * @return 首页配置
     */
    @Override
    public List<Home> selectHomeList(Home home)
    {
        return homeMapper.selectHomeList(home);
    }

    /**
     * 新增首页配置
     * 
     * @param home 首页配置
     * @return 结果
     */
    @Override
    public int insertHome(Home home)
    {
        home.setCreateTime(DateUtils.getNowDate());
        return homeMapper.insertHome(home);
    }

    /**
     * 修改首页配置
     * 
     * @param home 首页配置
     * @return 结果
     */
    @Override
    public int updateHome(Home home)
    {
        home.setUpdateTime(DateUtils.getNowDate());
        return homeMapper.updateHome(home);
    }

    /**
     * 批量删除首页配置
     * 
     * @param ids 需要删除的首页配置主键
     * @return 结果
     */
    @Override
    public int deleteHomeByIds(Long[] ids)
    {
        return homeMapper.deleteHomeByIds(ids);
    }

    /**
     * 删除首页配置信息
     * 
     * @param id 首页配置主键
     * @return 结果
     */
    @Override
    public int deleteHomeById(Long id)
    {
        return homeMapper.deleteHomeById(id);
    }
}
